﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.Mvc;
using ABC.Business.Models;
using ABC.Core.Configuration;
using ABC.Domain.Entities;

namespace ABC.Controllers.ViewModels.My
{
    public class CalcOsagoViewModel : BaseViewModel
    {
        public string Id { get; set; }

        public string ObjectId { get; set; }

        public string ObjectName { get; set; }

        public string Region { get; set; }

        public string Companies { get; set; }

        public List<ObjectOfInsurance> Objects { get; set; }

        public List<SelectListItem> ListForRegion { get; set; }

        public CalcOsagoViewModel()
        {
            var calcOsagoModel = IoC.Resolve<CalcOsagoModel>();
            ListForRegion  = new List<SelectListItem>();
            Objects = new List<ObjectOfInsurance>();
            ListForRegion = calcOsagoModel.GetRegions().Select(x => new SelectListItem { Value = x.Key, Text = x.Value }).ToList();
            ListForRegion.ForEach(x =>
                                      {
                                          switch (x.Text)
                                          {
                                              case "Москва":
                                                  x.Selected = true;
                                                  return;
                                          }
                                      });
        }
    }
}
